import request from '@/config/axios'
import {ServicePrefixEnum} from "@/enums/commonEnum";
import {RequestEnum} from "@/enums/httpEnum";
import type {AxiosRequestConfig} from "axios";
import {defHttp} from "@/utils/http/axios";

export type OperateLogVO = {
  id: number
  traceId: string
  userType: number
  userId: number
  userName: string
  type: string
  subType: string
  bizId: number
  action: string
  extra: string
  requestMethod: string
  requestUrl: string
  userIp: string
  userAgent: string
  creator: string
  creatorName: string
  createTime: Date
}

const MODULAR = '/system/operate-log';

export const Api = {
  GetOperateLogPage: {
    url: `${ServicePrefixEnum.BASE}/${MODULAR}/page`,
    method: RequestEnum.GET,
  } as AxiosRequestConfig,
}

// 查询操作日志列表
export const getOperateLogPage = (params) => {
  return defHttp.request({ ...Api.GetOperateLogPage,params})
}

// 导出操作日志 todo
export const exportOperateLog = (params: any) => {
  return request.download({ url: '/system/operate-log/export', params })
}
